package com.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/page")
public class SampleController {
	
	@RequestMapping(value = "/error")
	public String error() {
		int a = 1 / 0;
		return "hello";
	}

	
	@RequestMapping(value = "/register")
	public String ajax() {
		return "register";
	}

	/**
	 * 使用Model往模板里面传递参数
	 * 
	 * @param model
	 * @return
	 */
	@RequestMapping("/hello/themaleaf")
	public String themaleaf(Model model) {
		model.addAttribute("name", "Joshua");
		return "hello";
	}
}